/*
 * 文件名：RepairInfoServiceImpl.java 描述： 修改人：Administrator 修改时间：2016年4月14日 跟踪单号： 修改单号： 修改内容：
 */

package com.zcsy.manage.service.property.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.property.RepairInfo;
import com.zcsy.manage.persistence.property.RepairInfoDao;
import com.zcsy.manage.service.property.IRepairInfoService;

/**
 * @Title: RepairInfoServiceImpl.java
 * @Package： com.zcsy.manage.service.property.impl
 * @Description: 报修信息服务层实现类
 * @author xujl
 * @Copyright: 2016 武汉中财数元信息技术有限公司 All rights reserved.
 * @date 2016年4月14日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class RepairInfoServiceImpl implements IRepairInfoService {

    @Autowired
    private RepairInfoDao dao;

    @Override
    public int insert(RepairInfo record) {
        return dao.insert(record);
    }

    @Override
    public int updateByPrimaryKey(RepairInfo record) {
    	RepairInfo oldInfo = dao.selectByPrimaryKey(record.getId());
    	
    	oldInfo.setState(record.getState());
    	oldInfo.setMemo(record.getMemo());
    	oldInfo.setCost(record.getCost());
    	oldInfo.setPhoto(record.getPhoto());
    	oldInfo.setTitle(record.getTitle());
    	oldInfo.setContent(record.getContent());
    	oldInfo.setType(record.getType());
    	oldInfo.setLevel(record.getLevel());
    	
        return dao.updateByPrimaryKey(oldInfo);
    }

    @Override
    public int deleteByPrimaryKey(String id) {
        return dao.deleteByPrimaryKey(id);
    }

    @Override
    public RepairInfo selectByPrimaryKey(String id) {
        return dao.selectByPrimaryKey(id);
    }

    @Override
    public List<RepairInfo> selectByKeyword(RepairInfo record) {
        return dao.selectByKeyword(record);
    }
    
    @Override
    public List<RepairInfo> getRepairList(RepairInfo repairInfo) {
        return dao.getRepairList(repairInfo);
    }

    @Override
    public List<RepairInfo> getAll(String ownerId) {
        return dao.getAll(ownerId);
    }

}
